package library.service.impl;

import javax.annotation.Resource;

import library.config.MySqlSessionFactory;
import library.mapper.BookMapper;
import library.po.BookType;
import library.mapper.BookTypeMapper;
import library.service.BookTypeService;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class BookTypeServiceImpl implements BookTypeService {
    private SqlSession sqlSession;
    private BookTypeMapper bookTypeMapper;

    public BookTypeServiceImpl(){
        sqlSession = MySqlSessionFactory.getSqlSessionInstance();
        bookTypeMapper = sqlSession.getMapper(BookTypeMapper.class);
    }

    @Override
    public int deleteByPrimaryKey(Integer bookTypeId) {
        return bookTypeMapper.deleteByPrimaryKey(bookTypeId);
    }

    @Override
    public int insert(BookType record) {
        return bookTypeMapper.insert(record);
    }

    @Override
    public BookType selectByPrimaryKey(Integer bookTypeId) {
        return bookTypeMapper.selectByPrimaryKey(bookTypeId);
    }

    @Override
    public int updateByPrimaryKey(BookType record) {
        return bookTypeMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<BookType> selectAllBookType() {
        return bookTypeMapper.selectAllBookType();
    }

    @Override
    public BookType selectByTypeName(String name) {
        return bookTypeMapper.selectByTypeName(name);
    }

}
